<!DOCTYPE html>

<html class="app-ui">

	<head>
		<!-- Meta -->
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />

		<!-- Document title -->
		<title>年级与学科关系维护</title>

		<meta name="description" content="AppUI - Admin Dashboard Template & UI Framework" />
		<meta name="author" content="rustheme" />
		<meta name="robots" content="noindex, nofollow" />

		<!-- Favicons -->
		<link rel="apple-touch-icon" href="assets/img/favicons/apple-touch-icon.png" />
		<link rel="icon" href="assets/img/favicons/favicon.ico" />

		<!-- Google fonts -->
		<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:300,400,400italic,500,900%7CRoboto+Slab:300,400%7CRoboto+Mono:400" />

		<!-- Page JS Plugins CSS -->
		<link rel="stylesheet" href="assets/js/plugins/datatables/jquery.dataTables.min.css" />

		<!-- AppUI CSS stylesheets -->
		<link rel="stylesheet" id="css-font-awesome" href="assets/css/font-awesome.css" />
		<link rel="stylesheet" id="css-ionicons" href="assets/css/ionicons.css" />
		<link rel="stylesheet" id="css-bootstrap" href="assets/css/bootstrap.css" />
		<link rel="stylesheet" id="css-app" href="assets/css/app.css" />
		<link rel="stylesheet" id="css-app-custom" href="assets/css/app-custom.css" />




		<!-- End Stylesheets -->
	</head>

	<body class="app-ui layout-has-drawer layout-has-fixed-header">
		<script type="text/javascript" src="assets/js/jquery.min.js"></script>
		<script type="text/javascript" src="assets/js/address.js"></script>

		<script type="text/javascript">
			$(function() {
				var schId = 1; //模拟redis取得的数据
				 var schNm="南昌一中";//模拟redis取得的数据
				 var addUserId=1;//模拟redis取得的数据
				var userconterurl = "http://localhost:6200/";
				var token = sessionStorage.getItem("token");
				
				
				//获取日期
				function date(){
					var date = new Date();
					Y = date.getFullYear() + '-';
					M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
					D = date.getDate() + '' ;
					/* h = date.getHours() + ':';
					m = date.getMinutes() + ':';
					s = date.getSeconds(); */
					 return Y+M+D;
				}
				

                  $("#graType1").click(function(){
					  allNOcheck()
        			 allsubject();
                    });
                 $("#graType2").click(function(){
					  allNOcheck()
					 allsubject();
				 });
				 $("#graType3").click(function(){
					 allNOcheck()
				    allsubject();
				});
				
				//重置
				$("#resert").click(function(){
					allNOcheck()
				  });
				
				//修改
				$("#update").click(function(){
					var item=document.getElementsByName("items");
					var graId = $("#graType").val();
					var graNm = $("#graType").find("option:selected").text();
					var tests=$("#test").text().replace(/(^\s*)|(\s*$)/g, "");
					//console.log("zz"+tests);
					var  jsonArray=[];
					 for (var i=0;i<item.length;i++) {
						 if($(item[i]).prop("checked")){
							 var subId=$(item[i]).attr("class");
							 var subNm=$(item[i]).parent().text().replace(/(^\s*)|(\s*$)/g, "");
						 	jsonArray.push({"subId":subId,"subNm":subNm,"graId":graId,"graNm":graNm,"schId":schId,"schNm":schNm,"addTime":date(),"addUserId":addUserId});
						 }
							
						} 
					console.log(jsonArray);
					
					 $.ajax({
						headers: {
							"token": token
						},
						type: "post",
						//data:{_method:put},
						//数据，json字符串,规定连同请求发送到服务器的数据
						data: JSON.stringify(jsonArray),
						url: userconterurl + "gradeSubjectRelation/insertSubjectIntoGrade",
						contentType: "application/json",
						success: function(data) {
							if (data.code == 1001) {
								alert("修改成功");
							}
					
						},
						//请求失败，包含具体的错误信息
						error: function(e) {
							alert(":)");
							//checktoken();
						}
					}); 
				  });

                  //allcheck()
				function  allNOcheck(){
					var item=document.getElementsByName("items");
					 for (var i=0;i<item.length;i++) {
						$(item[i]).prop("checked",false);
						} 
					}
					
			

				function allsubject() {
					var graId = $("#graType").val();
					$.ajax({
						headers: {
							"token": token
						},
						type: "get",
						//data:{_method:put},
						//数据，json字符串,规定连同请求发送到服务器的数据
						data: {
							schId: schId,
							graId: graId
						},
						url: userconterurl + "gradeSubjectRelation/selectSubjectBygraId",
						contentType: "application/x-www-form-urlencoded",
						success: function(data) {
							if (data.code == 1001) {
								data = data.lists;
								
								for (var i = 0; i < data.length; i++) {
									if(data[i].subNm=="语文") {
										$('#yw').prop("checked",true);
										continue;
									}
									if(data[i].subNm=="数学") {
										$('#sx').prop("checked",true);
										continue;
									}
									if(data[i].subNm=="英语") {
										$('#yy').prop("checked",true);
										continue;
									}
									if(data[i].subNm=="物理") {
										$('#wl').prop("checked",true);
										continue;
									}
									if(data[i].subNm=="化学") {
										$('#hx').prop("checked",true);
										continue;
									}
									if(data[i].subNm=="生物") {
										$('#sw').prop("checked",true);
										continue;
									}
									if(data[i].subNm=="历史") {
										$('#ls').prop("checked",true);
										continue;
									}
									if(data[i].subNm=="地理") {
										$('#dl').prop("checked",true);
										continue;
									}
									if(data[i].subNm=="政治") {
										$('#zz').prop("checked",true);
										continue;
									}
									if(data[i].subNm=="文综") {
										$('#wz').prop("checked",true);
										continue;
									}
									if(data[i].subNm=="理综") {
										$('#lz').prop("checked",true);
										continue;
									}
								}
							}

						},
						//请求失败，包含具体的错误信息
						error: function(e) {
							alert(":)");
							//checktoken();
						}
					});
				}


                      function  insertsub(){
						  
						  
					  }







			})
		</script>




		<div class="app-layout-canvas">
			<div class="app-layout-container">

				<!-- Drawer -->
				<aside class="app-layout-drawer">

					<!-- Drawer scroll area -->
					<div class="app-layout-drawer-scroll">
						<!-- Drawer logo -->
						<div id="logo" class="drawer-header">
							<a href="index.html">
								<h4 style=" text-align:center">云阅卷</h4>
							</a>
						</div>

						<!-- Drawer navigation -->
						<nav class="drawer-main">
							<ul class="nav nav-drawer">


								<li class="nav-item nav-drawer-header">菜单导航</li>

								<li class="nav-item nav-item-has-subnav">
									<a href="javascript:void(0)"><i class="ion-ios-calculator-outline"></i>考试管理</a>
									<ul class="nav nav-subnav">

										<li>
											<a href="examList.html">考试列表</a>
										</li>

										<li>
											<a href="createExam.html">创建考试</a>
										</li>
									</ul>
								</li>

								<li class="nav-item nav-item-has-subnav">
									<a href="javascript:void(0)"><i class="ion-ios-compose-outline"></i> 在线阅卷</a>
									<ul class="nav nav-subnav">

										<li>
											<a href="examSetting.html">阅卷设置</a>
										</li>

										<li>
											<a href="examPapers.html">我要阅卷</a>
										</li>

										<li>
											<a href="examProblemPapers.html">问题卷处理</a>
										</li>
										<li>
											<a href="examProgress.html">进度监控</a>
										</li>

										<li>
											<a href="examQuality.html">质量抽查</a>
										</li>

									</ul>
								</li>


								<li class="nav-item nav-item-has-subnav">
									<a href="javascript:void(0)"><i class="ion-ios-list-outline"></i> 成绩管理</a>
									<ul class="nav nav-subnav">

										<li>
											<a href="examReport.html">考试成绩单</a>
										</li>

										<li>
											<a href="examSubReport.html">单科试题得分表</a>
										</li>

										<li>
											<a href="gradeAnalyze.html">年纪成绩分析</a>
										</li>

										<li>
											<a href="classAnalyze.html">班级成绩分析</a>
										</li>

									</ul>
								</li>

								<li class="nav-item nav-item-has-subnav">
									<a href="javascript:void(0)"><i class="ion-ios-browsers-outline"></i> 教师讲卷</a>
									<ul class="nav nav-subnav">

										<li>
											<a href="scoreAndPapers.html">成绩与答卷</a>
										</li>

										<li>
											<a href="highScoreComposition.html">高分作文</a>
										</li>

										<li>
											<a href="topicScore.html">试题得分情况</a>
										</li>

										<li>
											<a href="subAnalyzeReport.html">学科分析报表</a>
										</li>
									</ul>
								</li>

								<li class="nav-item nav-item-has-subnav">
									<a href="javascript:void(0)"><i class="ion-social-javascript-outline"></i> 用户中心</a>
									<ul class="nav nav-subnav">

										<li>
											<a href="schoolManager.html">学校管理</a>

										</li>

										<li>
											<a href="subManager.html">学科管理</a>
										</li>

										<li>
											<a href="gradeManager.html">年级管理</a>
										</li>

										<li>
											<a href="gradeAndSubManager.html">年级与学科关系维护</a>
										</li>

										<li>
											<a href="teaManager.html">教师管理</a>
										</li>

										<li>
											<a href="classManager.html">班级管理</a>
										</li>

										<li>
											<a href="stuManager.html">学生管理</a>
										</li>

										<li>
											<a href="subAdnClassAnager.html">学科与班级关系维护</a>
										</li>
									</ul>
								</li>

							</ul>
						</nav>
						<!-- End drawer navigation -->

						<div class="drawer-footer">
							<p class="copyright">Copyright &copy; 2020.北京万邦易嵌科技有限公司.<a target="_blank" href="http://www.wanbangee.com">万邦易嵌</a></p>
						</div>
					</div>
					<!-- End drawer scroll area -->
				</aside>
				<!-- End drawer -->

				<!-- Header -->
				<header class="app-layout-header">
					<nav class="navbar navbar-default">
						<div class="container-fluid">
							<div class="navbar-header">
								<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#header-navbar-collapse"
								 aria-expanded="false">
									<span class="sr-only">Toggle navigation</span>
									<span class="icon-bar"></span>
									<span class="icon-bar"></span>
									<span class="icon-bar"></span>
								</button>
								<button class="pull-left hidden-lg hidden-md navbar-toggle" type="button" data-toggle="layout" data-action="sidebar_toggle">
									<span class="sr-only">Toggle drawer</span>
									<span class="icon-bar"></span>
									<span class="icon-bar"></span>
									<span class="icon-bar"></span>
								</button>

							</div>

							<div class="collapse navbar-collapse" id="header-navbar-collapse">
								<!-- Header search form -->



								<!-- .navbar-left -->

								<ul class="nav navbar-nav navbar-right navbar-toolbar hidden-sm hidden-xs">
									<li>
										<!-- Opens the modal found at the bottom of the page -->
										<a href="javascript:void(0)" data-toggle="modal" data-target="#apps-modal"><i class="ion-grid"></i></a>
									</li>

									<li class="dropdown">
										<a href="javascript:void(0)" data-toggle="dropdown"><i class="ion-ios-bell"></i> <span class="badge">3</span></a>
										<ul class="dropdown-menu dropdown-menu-right">
											<li class="dropdown-header">Profile</li>
											<li>
												<a tabindex="-1" href="javascript:void(0)"><span class="badge pull-right">3</span> News </a>
											</li>
											<li>
												<a tabindex="-1" href="javascript:void(0)"><span class="badge pull-right">1</span> Messages </a>
											</li>
											<li class="divider"></li>
											<li class="dropdown-header">More</li>
											<li>
												<a tabindex="-1" href="javascript:void(0)">Edit Profile..</a>
											</li>
										</ul>
									</li>

									<li class="dropdown dropdown-profile">
										<a href="javascript:void(0)" data-toggle="dropdown">
											<span class="m-r-sm">John Doe <span class="caret"></span></span>
											<img class="img-avatar img-avatar-48" src="assets/img/avatars/avatar3.jpg" alt="User profile pic" />
										</a>
										<ul class="dropdown-menu dropdown-menu-right">
											<li class="dropdown-header">
												Pages
											</li>
											<li>
												<a href="base_pages_profile.html">Profile</a>
											</li>
											<li>
												<a href="base_pages_profile.html"><span class="badge badge-success pull-right">3</span> Blog</a>
											</li>
											<li>
												<a href="frontend_login_signup.html">Logout</a>
											</li>
										</ul>
									</li>
								</ul>
								<!-- .navbar-right -->
							</div>
						</div>
						<!-- .container-fluid -->
					</nav>
					<!-- .navbar-default -->
				</header>
				<!-- End header -->

				<main class="app-layout-content">

					<!-- Page Content -->
					<div class="container-fluid p-y-md">
						<!-- Dynamic Table Full -->
						<div class="card">
							<div class="card-header">
								<h4>年级与学科关系维护 </h4>

							</div>
							<div class="card-header">
								<div class="col-sm-9">
									<div class="form-material">
										<select class="form-control" id="graType" name="val-skill2" style="font-size: large;width: 100px;">
											<option id="graType1" value="1">高一</option>
											<option id="graType2" value="2">高二</option>
											<option id="graType3" value="3">高三</option>
										</select>
										<label for="val-skill2" style="font-size: large;">选择年级</label>
									</div>
								</div>
								<div >
									<button id="update" class="btn btn-app" type="submit" >修改</button>
									<!-- <button id="insertschool" class="btn btn-app" type="submit" style="display:none;">新增</button> -->
									<button  id="resert" style="margin-left:160px;" class="btn btn-app" type="reset">重置</button>
								</div>
							</div>
							<div id="subjectmanager" class="card-block">
								<div class="col-lg-4">
									<!-- Colors -->
									<div class="card">
										<div class="card-header">
											<h4>Colors</h4>
										</div>
										<div class="card-block">
											<div class="row">

												<div class="col-xs-6">
													<p>
														<label id="test" class="css-input switch switch-success">
															<input id="yw" name="items" type="checkbox" class="1"/><span></span>语文
														</label>
													</p>
												</div>
												<div class="col-xs-6">
													<p>
														<label class="css-input switch switch-success">
															<input id="sx" name="items" type="checkbox" class="2" /><span></span>数学
														</label>
													</p>
												</div>
												<div class="col-xs-6">
													<p>
														<label class="css-input switch switch-success">
															<input id="yy" name="items" type="checkbox" class="3"/><span></span>英语
														</label>
													</p>
												</div>
												<div class="col-xs-6">
													<p>
														<label class="css-input switch switch-success">
															<input id="ls" name="items" type="checkbox" class="4" /><span></span> 历史
														</label>
													</p>
												</div>
												<div class="col-xs-6">
													<p>
														<label class="css-input switch switch-success">
															<input id="zz" name="items" type="checkbox" class="5" /><span></span> 政治
														</label>
													</p>
												</div>
												<div class="col-xs-6">
													<p>
														<label class="css-input switch switch-success">
															<input id="dl" name="items" type="checkbox" class="6" /><span></span> 地理
														</label>
													</p>
												</div>
												<div class="col-xs-6">
													<p>
														<label class="css-input switch switch-success">
															<input id="hx" name="items" type="checkbox" class="7" /><span></span> 化学
														</label>
													</p>
												</div>
												<div class="col-xs-6">
													<p>
														<label class="css-input switch switch-success">
															<input id="wl" name="items" type="checkbox" class="8"/><span></span> 物理
														</label>
													</p>
												</div>
												<div class="col-xs-6">
													<p>
														<label class="css-input switch switch-success">
															<input id="sw" name="items" type="checkbox" class="9" /><span></span> 生物
														</label>
													</p>
												</div>
												<div class="col-xs-6">
													<p>
														<label class="css-input switch switch-success">
															<input id="wz" name="items" type="checkbox" class="10"/><span></span> 文综
														</label>
													</p>
												</div>
												<div class="col-xs-6">
													<p>
														<label class="css-input switch switch-success">
															<input id="lz" name="items" type="checkbox" class="11" /><span></span> 理综
														</label>
													</p>
												</div>







											</div>
										</div>
										<!-- .card-block -->
									</div>
									<!-- .card -->
									<!-- End Colors -->
								</div>
								<div id="allsubject" class="card-block"></div>
								
								<!-- DataTables init on table by adding .js-dataTable-full class, functionality initialized in js/pages/base_tables_datatables.js -->
								<!-- <table class="table table-bordered table-striped table-vcenter js-dataTable-full">
                                    <thead>
                                        <tr>
                                            <th class="text-center"></th>
                                            <th>Name</th>
                                            <th class="hidden-xs">Email</th>
                                            <th class="hidden-xs w-20">Position</th>
                                            <th class="text-center" style="width: 10%;">Actions</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td class="text-center">1</td>
                                            <td class="font-500">Denise Watson</td>
                                            <td class="hidden-xs">client1@example.com</td>
                                            <td class="hidden-xs">Accountant</td>
                                            <td class="text-center">
                                                <div class="btn-group">
                                                    <button class="btn btn-xs btn-default" type="button" data-toggle="tooltip" title="Edit Client"><i class="ion-edit"></i></button>
                                                    <button class="btn btn-xs btn-default" type="button" data-toggle="tooltip" title="Remove Client"><i class="ion-close"></i></button>
                                                </div>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="text-center">2</td>
                                            <td class="font-500">Ethan Howard</td>
                                            <td class="hidden-xs">client2@example.com</td>
                                            <td class="hidden-xs">Technical Author</td>
                                            <td class="text-center">
                                                <div class="btn-group">
                                                    <button class="btn btn-xs btn-default" type="button" data-toggle="tooltip" title="Edit Client"><i class="ion-edit"></i></button>
                                                    <button class="btn btn-xs btn-default" type="button" data-toggle="tooltip" title="Remove Client"><i class="ion-close"></i></button>
                                                </div>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="text-center">3</td>
                                            <td class="font-500">Denise Watson</td>
                                            <td class="hidden-xs">client3@example.com</td>
                                            <td class="hidden-xs">Developer</td>
                                            <td class="text-center">
                                                <div class="btn-group">
                                                    <button class="btn btn-xs btn-default" type="button" data-toggle="tooltip" title="Edit Client"><i class="ion-edit"></i></button>
                                                    <button class="btn btn-xs btn-default" type="button" data-toggle="tooltip" title="Remove Client"><i class="ion-close"></i></button>
                                                </div>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="text-center">4</td>
                                            <td class="font-500">Evelyn Willis</td>
                                            <td class="hidden-xs">client4@example.com</td>
                                            <td class="hidden-xs">Integration Specialist</td>
                                            <td class="text-center">
                                                <div class="btn-group">
                                                    <button class="btn btn-xs btn-default" type="button" data-toggle="tooltip" title="Edit Client"><i class="ion-edit"></i></button>
                                                    <button class="btn btn-xs btn-default" type="button" data-toggle="tooltip" title="Remove Client"><i class="ion-close"></i></button>
                                                </div>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="text-center">5</td>
                                            <td class="font-500">Ethan Howard</td>
                                            <td class="hidden-xs">client5@example.com</td>
                                            <td class="hidden-xs">Regional Director</td>
                                            <td class="text-center">
                                                <div class="btn-group">
                                                    <button class="btn btn-xs btn-default" type="button" data-toggle="tooltip" title="Edit Client"><i class="ion-edit"></i></button>
                                                    <button class="btn btn-xs btn-default" type="button" data-toggle="tooltip" title="Remove Client"><i class="ion-close"></i></button>
                                                </div>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="text-center">6</td>
                                            <td class="font-500">Carl Snyder</td>
                                            <td class="hidden-xs">client6@example.com</td>
                                            <td class="hidden-xs">Designer</td>
                                            <td class="text-center">
                                                <div class="btn-group">
                                                    <button class="btn btn-xs btn-default" type="button" data-toggle="tooltip" title="Edit Client"><i class="ion-edit"></i></button>
                                                    <button class="btn btn-xs btn-default" type="button" data-toggle="tooltip" title="Remove Client"><i class="ion-close"></i></button>
                                                </div>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="text-center">7</td>
                                            <td class="font-500">Jack Greene</td>
                                            <td class="hidden-xs">client7@example.com</td>
                                            <td class="hidden-xs">Regional Director</td>
                                            <td class="text-center">
                                                <div class="btn-group">
                                                    <button class="btn btn-xs btn-default" type="button" data-toggle="tooltip" title="Edit Client"><i class="ion-edit"></i></button>
                                                    <button class="btn btn-xs btn-default" type="button" data-toggle="tooltip" title="Remove Client"><i class="ion-close"></i></button>
                                                </div>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="text-center">8</td>
                                            <td class="font-500">Amber Walker</td>
                                            <td class="hidden-xs">client8@example.com</td>
                                            <td class="hidden-xs">Regional Director</td>
                                            <td class="text-center">
                                                <div class="btn-group">
                                                    <button class="btn btn-xs btn-default" type="button" data-toggle="tooltip" title="Edit Client"><i class="ion-edit"></i></button>
                                                    <button class="btn btn-xs btn-default" type="button" data-toggle="tooltip" title="Remove Client"><i class="ion-close"></i></button>
                                                </div>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="text-center">9</td>
                                            <td class="font-500">Ethan Howard</td>
                                            <td class="hidden-xs">client9@example.com</td>
                                            <td class="hidden-xs">Regional Director</td>
                                            <td class="text-center">
                                                <div class="btn-group">
                                                    <button class="btn btn-xs btn-default" type="button" data-toggle="tooltip" title="Edit Client"><i class="ion-edit"></i></button>
                                                    <button class="btn btn-xs btn-default" type="button" data-toggle="tooltip" title="Remove Client"><i class="ion-close"></i></button>
                                                </div>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="text-center">10</td>
                                            <td class="font-500">Craig Stone</td>
                                            <td class="hidden-xs">client10@example.com</td>
                                            <td class="hidden-xs">Designer</td>
                                            <td class="text-center">
                                                <div class="btn-group">
                                                    <button class="btn btn-xs btn-default" type="button" data-toggle="tooltip" title="Edit Client"><i class="ion-edit"></i></button>
                                                    <button class="btn btn-xs btn-default" type="button" data-toggle="tooltip" title="Remove Client"><i class="ion-close"></i></button>
                                                </div>
                                            </td>
                                        </tr>
                                  
                                        
                                    </tbody>
                                </table> -->
							</div>
							<!-- .card-block -->
						</div>
						<!-- .card -->
						<!-- End Dynamic Table Full -->

						<!-- Dynamic Table Simple -->
						<div class="card">

						</div>
						<!-- .card -->
						<!-- End Dynamic Table Simple -->
					</div>
					<!-- .container-fluid -->
					<!-- End Page Content -->

				</main>

			</div>
			<!-- .app-layout-container -->
		</div>
		<!-- .app-layout-canvas -->



		<div class="app-ui-mask-modal"></div>

		<!-- AppUI Core JS: jQuery, Bootstrap, slimScroll, scrollLock and App.js -->
		<script src="assets/js/core/jquery.min.js"></script>
		<script src="assets/js/core/bootstrap.min.js"></script>
		<script src="assets/js/core/jquery.slimscroll.min.js"></script>
		<script src="assets/js/core/jquery.scrollLock.min.js"></script>
		<script src="assets/js/core/jquery.placeholder.min.js"></script>
		<script src="assets/js/app.js"></script>
		<script src="assets/js/app-custom.js"></script>

		<!-- Page JS Plugins -->
		<script src="assets/js/plugins/datatables/jquery.dataTables.min.js"></script>

		<!-- Page JS Code -->
		<script src="assets/js/pages/base_tables_datatables.js"></script>

	</body>

</html>
